import Errors from "../../components/Errors";
import { useDispatch } from "react-redux";
import { userLogout } from "../../store/module/settingSlice";
import { useNavigate } from "react-router-dom";
import { Button } from "antd";
import SettingForm from "./SettingForm";
function Setting() {
  let dispatch = useDispatch();
  let navigate = useNavigate();
  let logout = () => {
    // 触发用户退出操作
    dispatch(userLogout());
    // 跳转到登录页面
    navigate("/login");
  };

  return (
    <div className="container">
      <Errors errors={null} />
      <SettingForm></SettingForm>
      <Button
        size="large"
        color="primary"
        variant="outlined"
        className="pull-xs-right"
        onClick={logout}
      >
        退出登录
      </Button>
    </div>
  );
}

export default Setting;
